<template>
	<div class="gift">
		<!--成功显示礼券领取成功的message-box-->
		<div class="gift-container">
			<Header/>
			<div class="gift-list">
				<gift-item v-for="item in coupons" :key="item.id" :giftItem="item"/>
			</div>
		</div>
		<go-back></go-back>
	</div>
</template>

<script>
	import Gift from '@/services/gift';
	import Header from '#/Gift/Header';
	import giftItem from '#/Gift/gift-item';
	import GoBack from '#/Public/GoBack';

	const _gift = new Gift();
	export default {
		name: "Gift",
		data() {
			return {
				coupons: []
			}
		},
		created() {
			this.getCoupons();
		},
		methods: {
			getCoupons() {
				_gift.getCoupons().then(res => {
					this.coupons = res.data;
					console.log(res.data)
				})
			}
		},
		components: {
			Header,
			giftItem,
			GoBack
		}
	}
</script>
